C++ Primer Plus (Eiji Yamane's Library) by Stephen Prata

C++ Primer Plus (Eiji Yamane's Library) by Stephen Prata

Author:Stephen Prata
Language: eng
Format: epub, mobi
Publisher: Addison-Wesley
Published: 2012-03-25T16:00:00+00:00


Again, destructors are called in the following situations (refer to Figure 12.4):

• If an object is an automatic variable, the object’s destructor is called when the program exits the block in which the object is defined. Thus, in Listing 12.3 the destructor is called for headlines[0] and headlines[1] when the program exits main(), and the destructor for grub is called when the program exits callme1().

• If an object is a static variable (external, static, static external, or from a namespace), its destructor is called when the program terminates. This is what happened for the sports object in Listing 12.3.

• If an object is created by new, its destructor is called only when you explicitly use delete on the object.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.